import { BasicColumn, FormSchema } from '@/components/Table';

import { Calendar } from 'ant-design-vue';
import { h } from 'vue';
import { VxeFormItemProps, VxeGridPropTypes } from '@/components/VxeTable';
import { optionsListApi } from '@/api/demo/select';

type CheckedType = boolean | string | number;
export const columns: BasicColumn[] = [
  {
    title: 'ms采购单号',
    dataIndex: 'orderNo',
    width: 150,
  },
  {
    title: '采购金额',
    dataIndex: 'orderPrice',
  },
  {
    title: '供应商编号',
    width: 100,
    dataIndex: 'supplierNo',
  },
  {
    title: '供应商名称',
    dataIndex: 'supplierName',
  },
  {
    title: '签单日期',
    dataIndex: 'orderDate',
    width: 110,
  },
  {
    title: '物料编号',
    dataIndex: 'materialNo',
    width: 120,

    //mp3Url remoteUrl
  },
  {
    title: '物料名称',
    dataIndex: 'materialName',
  },
  {
    title: '物料规格',
    dataIndex: 'specification',
  },
  {
    title: '物料型号',
    width: 100,
    dataIndex: 'model',
  },
  {
    title: '下单数量',
    dataIndex: 'orderNum',
    width: 100,
  },
  {
    title: '批号',
    dataIndex: 'no',
    width: 130,
  },
  {
    title: '下单人',
    dataIndex: 'userName',
    width: 100,
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 100,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'orderNo',
    label: '采购单号',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'supplierName',
    label: '供应商名称',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'materialName',
    label: '物料名称',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'IfXuNiJian',
    label: '是否查询虚拟件',
    component: 'Select',
    colProps: { span: 5 },
    defaultValue: 1,
    componentProps: {
      options: [
        { label: '是', value: 1 },
        { label: '否', value: 0 },
      ],
    },
  },
  {
    field: 'orderDateStart',
    label: '签单起始日期',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
    colProps: { span: 5 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'userName',
    label: '成员名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'isRead',
    label: '是否参与读书',
    component: 'Select',
    componentProps: {
      options: [
        { label: '否', value: 0 },
        { label: '是', value: 1 },
      ],
    },
  },
];

export const vxeTableColumns: VxeGridPropTypes.Columns = [
  // {
  //   title: '序号',
  //   type: 'seq',
  //   fixed: 'left',
  //   width: '50',
  //   align: 'center',
  // },
  {
    title: 'ms采购单号',
    field: 'orderNo',
    width: 130,
    showOverflow: 'title',
  },
  {
    title: '采购金额',
    field: 'orderPrice',
    width: 80,
    showOverflow: 'title',
  },
  {
    title: '供应商编号',
    width: 70,
    field: 'supplierNo',
    showOverflow: 'title',
  },
  {
    title: '供应商名称',
    field: 'supplierName',
    showOverflow: 'title',
  },
  {
    title: '签单日期',
    field: 'orderDate',
    width: 90,
  },
  {
    title: '物料编号',
    field: 'materialNo',
    width: 90,
    showOverflow: 'title',

    //mp3Url remoteUrl
  },
  {
    title: '物料名称',
    field: 'materialName',
    showOverflow: 'title',
  },
  {
    title: '物料规格',
    field: 'specification',
    showOverflow: 'title',
  },
  {
    title: '物料型号',
    width: 80,
    field: 'model',
    showOverflow: 'title',
  },
  {
    title: '下单数量',
    field: 'orderNum',
    width: 80,
  },
  {
    title: '是否符合退款条件',
    field: 'isReturn',
    width: 120,
    showOverflow: 'title',
    align: 'center',
    slots: { default: 'isReturn_default' },
  },
  {
    title: '下单人',
    field: 'userName',
    width: 80,
  },
  {
    title: '备注',
    field: 'remark',
    showOverflow: 'title',

    width: 100,
  },
  // {
  //   width: 90,
  //   title: '操作',
  //   align: 'center',
  //   slots: { default: 'action' },
  //   fixed: 'right',
  // },
];

export const vxeTableFormSchema: VxeFormItemProps[] = [
  {
    span: 5,
    field: 'orderNo',
    title: '采购单号',
    itemRender: {
      name: 'AInput',
    },
  },
  {
    span: 5,
    field: 'supplierName',
    title: '供应商名称',
    itemRender: {
      name: 'AInput',
    },
  },
  {
    span: 5,
    field: 'materialName',
    title: '物料名称',
    itemRender: {
      name: 'AInput',
    },
  },
  {
    span: 5,
    field: 'materialNo',
    title: '物料编号',
    itemRender: {
      name: 'AInput',
    },
  },
  // {
  //   field: 'IfXuNiJian',
  //   title: '是否查询虚拟件',
  //   span:5,
  //   itemRender: {
  //     name: 'ASelect',
  //     // defaultValue: 1,
  //     props: {
  //       options: [
  //         { label: '是', value: 1 },
  //         { label: '否', value: 0 },
  //       ],
  //     },
  //   },
  // },
  {
    field: 'orderDateStart',
    title: '签单起始日期',
    span: 5,
    itemRender: {
      name: 'ADatePicker',
      props: {
        valueFormat: 'YYYY-MM-DD',
        format: 'YYYY-MM-DD',
      },
    },
  },
  {
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'submit', content: '搜索', status: 'primary' },
        { type: 'reset', content: '重置' },
      ],
    },
  },
];
